﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using TerminologiaSinacor.Presenter;


public partial class page_FontesChaveTeste : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void BtnLimpar_Click(object sender, EventArgs e)
    {
        txtNomeTermo.Text = "";
    }

    protected void BtnPesquisar_Click(object sender, EventArgs e)
    {
        Fontes fontes = new Fontes();
        fontes.NomeTermo = txtNomeTermo.Text;
        this.ViewState["NomeTermo"] = fontes;
        BindingGrid(fontes);
    }


    private void BindingGrid(Fontes fontes)
    {
        List<Fontes> fontess = new List<Fontes>();
        fontess = fontes.search(fontes);
        GrdFontes.DataSource = fontess;
        GrdFontes.DataBind();
    }

    protected void GrdFontes_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        Fontes fontes = (Fontes)ViewState["NomeTermo"];
        this.GrdFontes.PageIndex = e.NewPageIndex;
        BindingGrid(fontes);
    }

    //Evento responsável por alterar a cor da linha do gridview quando passo o mouse por cima
    protected void GrdFontesChave_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes.Add("onMouseOver", "this.style.backgroundColor='#DAA520'; this.style.cursor='hand';");
            e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor='#ffffff'");
            e.Row.Attributes.Add("onClick", "this.style.backgroundColor='#DAA520'; CarregarCampoFonteChave(this);");
        }
    }
      
}
